package main

// Definition for singly-linked list.
type ListNode struct {
	Val  int
	Next *ListNode
}

func getDecimalValue(head *ListNode) int {
	res := head.Val
	node := head.Next
	for node != nil {
		res = res << 1
		res |= node.Val
		node = node.Next
	}

	return res
}
